<template>
    <div class="brand-box">
        <!--        <h1>我的天</h1>-->
        <div class="search-box">
            <el-form :inline="true" class="demo-form-inline" size="mini">
                <el-form-item label="商品名称" style="float: left">
                    <el-input placeholder="商品名称" v-model="searchParams.goodName"></el-input>
                </el-form-item>
                <el-form-item label="审批状态" :label-width="formLabelWidth" prop="colorId" style="float: left">
                    <el-select v-model="searchParams.checkId">
                        <el-option v-for="type in colorList" :key="type.checkId" :label="type.checkName"
                                   :value="type.checkId">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="findPage" style="margin-left: 600px">查询</el-button>
                    <el-button type="warning" @click="resetForm">重置</el-button>
                </el-form-item>
            </el-form>
        </div>
        <!--操作按钮 @click="dialogVisible=true,formData={},imageUrl=''"-->
        <div class="crud-box">
            <el-button style="margin-right: 52px;float: right" type="primary" icon="el-icon-edit" size="mini"
            >新增价格调整申请
            </el-button>
            <!--            <el-button type="success" icon="el-icon-edit" size="mini">修改</el-button>-->
            <!--            <el-button type="danger" icon="el-icon-delete" size="mini">删除</el-button>-->
        </div>
        <!--table展示数据-->
        <div class="table-box">
            <el-table
                    :data="tableData"
                    style="width: 100%"
                    @selection-change="checkBoxSelectionChange"
            >

                <el-table-column
                        type="selection"
                        width="55">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="goodName"
                        label="商品名称"
                        width="180">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="goodMallprice"
                        label="原商城价"
                        width="180">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="goodAftermall"
                        label="调整后商城价" width="180">

                </el-table-column>
                <el-table-column
                        align="center"
                        prop="goodRuntime"
                        label="价格生效时间" width="300">
                    <template slot-scope="scope">
                        <span>{{ parseDateFull(scope.row.goodRuntime) }}</span>
                    </template>
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="checkName"
                        label="审批状态"
                        width="180">
                    <template v-slot="obj">
                        <span v-if="obj.row.goodCheckid=== 1" style="color: #606266">{{obj.row.checkName}}</span>
                        <span v-else style="color: firebrick">{{obj.row.checkName}}</span>
                    </template>
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="address"
                        label="操作" width="400">
                    <template v-slot="obj">
                        <el-button type="success" icon="el-icon-edit" size="mini" style="float: left"
                                   @click="look=true,initProduct(obj.row)">
                            查看
                        </el-button>
                        <el-button type="success" icon="el-icon-edit" size="mini" style="margin-right: 10px" v-if="obj.row.goodCheckid=== 1?false:true"
                                   @click="dialogVisibleEdit=true,editPrice(obj.row)">
                            修改
                        </el-button>
<!--                        <span v-if="isshow">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>-->
                        <el-popconfirm
                                confirm-button-text='确认'
                                cancel-button-text='取消'
                                @confirm="deleteProductById"
                                icon="el-icon-info"
                                icon-color="red"
                                title="确定删除这一条数据吗？"
                        >
                            <el-button slot="reference" type="danger" icon="el-icon-delete" size="mini" v-if="obj.row.goodCheckid=== 1?false:true"
                                       style="margin-right: 10px"
                                       @click="deleteForm.brandId=obj.row.brandId">删除
                            </el-button>
                        </el-popconfirm>
                        <el-button type="success" icon="el-icon-edit" size="mini" style="float: right"
                                   @click="dialogVisibleEdit=true,initProduct(obj.row)">
                            审核跟踪
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>
        </div>
        <!--分页-->
        <div class="page-box">
            <el-pagination
                    background
                    :current-page="searchParams.currentPage"
                    :page-size="searchParams.pageSize"
                    layout="prev, pager, next"
                    @current-change="currentPageChange"
                    :total="total">
            </el-pagination>
        </div>


        <!--弹框-->
        <div class="dialog-box">
            <el-dialog
                    title="添加"
                    :visible.sync="dialogVisible"
                    width="40%"
            >
                <el-form ref="form" :model="formData" label-width="240px">
                    <el-form-item label="产品型号" style="margin-right: 200px">
                        <el-input placeholder="产品型号" v-model="formData.productModel" style="width: 205px"></el-input>
                    </el-form-item>


                    <el-form-item label="基础库-颜色" :label-width="formLabelWidth" prop="colorId"
                                  style="margin-left: 120px">
                        <el-select v-model="formData.productColorid">
                            <el-option v-for="type in colorList" :key="type.colorId" :label="type.colorName"
                                       :value="type.colorId">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <br>
                    <el-form-item label="基础库-产品品牌" :label-width="formLabelWidth" prop="brandId"
                                  style="margin-left: 120px">
                        <el-select v-model="formData.productBrandid">
                            <el-option v-for="type in brandList" :key="type.brandId" :label="type.brandName"
                                       :value="type.brandId">
                            </el-option>
                        </el-select>
                    </el-form-item>

                    <el-form-item label="基础库-产品分类" :label-width="formLabelWidth" prop="typeId"
                                  style="margin-left: 120px">
                        <el-select v-model="formData.productTypeid">
                            <el-option v-for="type in typeList" :key="type.typeId" :label="type.typeName"
                                       :value="type.typeId">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-form>
                <br>
                <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false" size="small">取 消</el-button>
    <el-button type="primary" @click="dialogVisible = false,addOrEdit()" size="small">确 定</el-button>
                </span>
            </el-dialog>

        </div>
        <div class="dialog-box">
            <el-dialog
                    title="查看"
                    :visible.sync="look"
                    width="40%"
            >
                <el-form ref="form" :model="lookData" label-width="240px">
                    <el-form-item label="商品ID:" style="margin-right: 200px">
                        {{lookData.goodId}}
                    </el-form-item>
                    <el-form-item label="商品名称:" style="margin-right: 200px">
                        {{lookData.goodName}}
                    </el-form-item>
                    <el-form-item label="商品库存:" style="margin-right: 200px">
                        {{lookData.goodMinstorage}}
                    </el-form-item>
                    <el-form-item label="调整前的价格:" style="margin-right: 200px">
                        <span style="float: left">市场价：</span>
                        <el-input placeholder="市场价" v-model="lookData.goodMarketprice"
                                  style="width: 70px;float: left;margin-right: 10px"></el-input>
                        <span style="float: left"> 商城价:</span>
                        <el-input placeholder="商城价" v-model="lookData.goodMallprice"
                                  style="width: 70px;float: left;margin-left: 10px"></el-input>
                    </el-form-item>
                    <el-form-item label="调整后的价格:" style="margin-right: 200px">
                        <span style="float: left">市场价：</span>
                        <el-input placeholder="市场价" v-model="lookData.goodAftermarket"
                                  style="width: 70px;float: left;margin-right: 10px"></el-input>
                        <span style="float: left"> 商城价:</span>
                        <el-input placeholder="商城价" v-model="lookData.goodAftermall"
                                  style="width: 70px;float: left;margin-left: 10px"></el-input>
                    </el-form-item>
                    <el-form-item label="希望价格生效时间:" style="margin-right: 200px">
                        <template>
                            <span>{{ parseDateFull(lookData.goodRuntime) }}</span>
                        </template>
                    </el-form-item>
                    <el-form-item label="希望价格失效时间:" style="margin-right: 200px">
                        <!--                        <el-input placeholder="希望价格失效时间" v-model="lookData.goodOuttime" style="width: 205px"></el-input>-->
                        <template>
                            <span>{{ parseDateFull(lookData.goodOuttime) }}</span>
                        </template>
                    </el-form-item>
                    <el-form-item label="活动情况或原因:" style="margin-right: 200px">
                        {{lookData.goodPricereason}}
                    </el-form-item>
                    <el-form-item label="备注:" style="margin-right: 200px">
                        {{lookData.goodComment}}
                    </el-form-item>
                </el-form>
                <!--                <br>-->
                <!--                <span slot="footer" class="dialog-footer">-->
                <!--    <el-button @click="look = false" size="small">取 消</el-button>-->
                <!--    <el-button type="primary" @click="look = false,productEdit()" size="small">确 定</el-button>-->
                <!--                </span>-->
            </el-dialog>
        </div>
        <div class="dialog-box">
            <el-dialog
                    title="修改"
                    :visible.sync="dialogVisibleEdit"
                    width="40%"
            >
                <el-form ref="form" :model="editData" label-width="240px">
                    <el-form-item label="商品ID:" style="margin-right: 200px">
                        {{editData.goodId}}
                    </el-form-item>
                    <el-form-item label="商品名称:" style="margin-right: 200px">
                        {{editData.goodName}}
                    </el-form-item>
                    <el-form-item label="商品库存:" style="margin-right: 200px">
                        {{editData.goodMinstorage}}
                    </el-form-item>
                    <el-form-item label="调整前的价格:" style="margin-right: 200px">
                        <span style="float: left">市场价：</span>
                        <el-input placeholder="市场价" v-model="editData.goodMarketprice"
                                  style="width: 70px;float: left;margin-right: 10px" disabled="disabled"></el-input>
                        <span style="float: left"> 商城价:</span>
                        <el-input placeholder="商城价" v-model="editData.goodMallprice"
                                  style="width: 70px;float: left;margin-left: 10px" disabled="disabled"></el-input>
                    </el-form-item>
                    <el-form-item label="调整后的价格:" style="margin-right: 200px">
                        <span style="float: left">市场价：</span>
                        <el-input placeholder="市场价" v-model="editData.goodAftermarket"
                                  style="width: 70px;float: left;margin-right: 10px"></el-input>
                        <span style="float: left"> 商城价:</span>
                        <el-input placeholder="商城价" v-model="editData.goodAftermall"
                                  style="width: 70px;float: left;margin-left: 10px"></el-input>
                    </el-form-item>


                    <el-form-item label="希望价格生效时间:" style="margin-right: 200px">
                        <template>
                       <el-input v-model="editData.goodRuntime"></el-input>
                        </template>
                    </el-form-item>
                    <el-form-item label="希望价格失效时间:" style="margin-right: 200px">
                        <!--                        <el-input placeholder="希望价格失效时间" v-model="editData.goodOuttime" style="width: 205px"></el-input>-->
                        <template>
                            <el-input v-model="editData.goodOuttime"></el-input>
                        </template>
                    </el-form-item>
                    <el-form-item label="活动情况或原因:" style="margin-right: 200px">
                        <el-input v-model="editData.goodPricereason"></el-input>
                    </el-form-item>
                    <el-form-item label="备注:" style="margin-right: 200px">
                        <el-input v-model="editData.goodComment"></el-input>
                    </el-form-item>
                </el-form>
                <br>
                <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisibleEdit = false" size="small">取 消</el-button>
    <el-button type="primary" @click="dialogVisibleEdit = false,addTypes()" size="small">确 定</el-button>
                </span>
            </el-dialog>
        </div>
    </div>

</template>

<script>
    import priceadjust from './priceadjust'

    export default priceadjust;
</script>

<style src="./index.scss" lang="scss">
</style>